﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsServiceClient
{
    internal class ProcessInfo
    {
        private int pid;
        private DateTime startTime;
        private bool lastStatus;

        public ProcessInfo()
        {
        }

        public ProcessInfo(int pid, DateTime startTime, bool lastStatus)
        {
            this.pid = pid;
            this.startTime = startTime;
            this.lastStatus = lastStatus;
        }

        public int Pid { get => pid; set => pid = value; }
        public DateTime StartTime { get => startTime; set => startTime = value; }
        public bool LastStatus { get => lastStatus; set => lastStatus = value; }
    }

    class WeekRecord 
    {
        private DateTime weekStart;
        private int weekCount;
        private List<DayRecord> dayRecords;

        public DateTime WeekStart { get => weekStart; set => weekStart = value; }
        public int WeekCount { get => weekCount; set => weekCount = value; }

        internal List<DayRecord> DayRecords { get => dayRecords; set => dayRecords = value; }

        public override string ToString()
        {
            return base.ToString();
        }
    }

    class DayRecord
    {
        private int weekDay;
        private List<GameRecord> gameRecords;

        public int WeekDay { get => weekDay; set => weekDay = value; }
        internal List<GameRecord> GameRecords { get => gameRecords; set => gameRecords = value; }
    }

    class GameRecord
    {
        private DateTime startTime;
        private DateTime endTime;
        private int duration;

        public DateTime StartTime { get => startTime; set => startTime = value; }
        public DateTime EndTime { get => endTime; set => endTime = value; }
        public int Duration { get => duration; set => duration = value; }
    }

    class IniConfig
    {
        private List<string> names;
        private string path;
        private int monitorPeriod;
        private int maxTimes;
        private int validDuration;

        public IniConfig(List<string> names, string path, int monitorPeriod, int maxTimes, int validDuration)
        {
            this.names = names;
            this.path = path;
            this.monitorPeriod = monitorPeriod;
            this.maxTimes = maxTimes;
            this.validDuration = validDuration;
        }

        public List<string> Names { get => names; set => names = value; }
        public string Path { get => path; set => path = value; }
        public int MonitorPeriod { get => monitorPeriod; set => monitorPeriod = value; }
        public int MaxTimes { get => maxTimes; set => maxTimes = value; }
        public int ValidDuration { get => validDuration; set => validDuration = value; }

        public override string ToString()
        {
            StringBuilder nameList = new StringBuilder();
            foreach (string name in names) {
                nameList.Append(name + ",");
            }
            string str = $"names={nameList},path={path},monitorPeriod={monitorPeriod},maxTimes={maxTimes},validDuration={validDuration}";
            return str;
        }
    }
}
